//
//  ByCellOrderDetailThird.m
//  oc_knowledge
//
//  Created by mc on 17/1/20.
//  Copyright © 2017年 com.itboye. All rights reserved.
//

#import "ByCellOrderDetailThird.h"

@implementation ByCellOrderDetailThird
+ (instancetype)cellWithTableView:(UITableView*)tableView{
    
    static NSString *cellIdentifier = @"ByCellOrderDetailThird";
    ByCellOrderDetailThird *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
    }
    return self;
}

-(void)setDetailModel:(ByModelOrderDetail *)detailModel{
    for (UIView *subView in self.subviews) {
        [subView removeFromSuperview];
    }
    _detailModel       = detailModel;
    NSString *str1     = [NSString stringWithFormat:@"订单编号：%@",_detailModel.order_code];
    NSString *str2     = [NSString stringWithFormat:@"交易号：%@",_detailModel.pay_code];
    NSString *str3     = [NSString stringWithFormat:@"创建时间：%@",[NSDate getDateStringFromeNumber:[NSNumber numberWithInteger:[_detailModel.createtime  integerValue]]]];
    
    NSArray *titleAry  = @[str1,str2,str3];
    //动态创建
    CGFloat x,y,width,height;
    height = 15;
    for (int i = 0; i < titleAry.count; i ++) {
        x      = 10;
        y      = 10*(i + 1) + height *i;
        width  = SCREEN_WIDTH;
        UILabel *label  = [[UILabel alloc] initWithFrame:CGRectMake(x, y, width, height)];
        [self addSubview:label];
        label.text      = titleAry[i];
        label.textColor = [UIColor lightGrayColor];
        label.font = FONT(14);
        
    }
}

@end
